package cn.wolfcode.trip.base.domain;

import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class Hotel extends BaseDomain {

    public static final int TYPE_ROMANTIC = 1;
    public static final int TYPE_BUSINESS = 2;
    public static final int TYPE_FAMILY = 3;

    private Area place;//关联地区

    private String title;//标题

    private String coverUrl;//封面

    private Long price;//价格

    private String subtitle;//副标题

    private String location;//具体地址

    private Long grades;//评分

    private Integer type = TYPE_BUSINESS;

    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", getId());
        map.put("title", title);
        map.put("subtitle", subtitle);
        map.put("coverUrl", coverUrl);
        map.put("price", price);
        map.put("location", location);
        map.put("grades", grades);
        map.put("type", getTypeName());
        if (place != null) {
            map.put("placeId", place.getId());
        }
        return JSONUtils.toJSONString(map);
    }

    public String getTypeName() {
        if (type == 1) {
            return "浪漫酒店";
        } else if (type == 2) {
            return "商务酒店";
        } else {
            return "家庭类型";
        }
    }

}